var CustomerReservationsUpdateLog = {
    id: "CustomerReservationsUpdateLogTable",
    seItem: null,
    table: null,
    layerIndex: -1
};
CustomerReservationsUpdateLog.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '', field: 'id', visible: false, align: 'center', valign: 'middle', width: '50px'},
        {title: '操作人', field: 'singlePerson', align: 'center', valign: 'middle', sortable: true, width: 90},
        {title: '患者电话', field: 'customerPhone', align: 'center', valign: 'middle', sortable: true, width: 130},
        {title: '患者姓名', field: 'customerName', align: 'center', valign: 'middle', sortable: true, width: 110},
        {title: '咨询项目', field: 'appointmentPayService', align: 'center', valign: 'middle', sortable: true, width: 110,
            formatter: function (value, row, index) {
                return "<span title='"+value+"'>" + value + "</span>"
            },
            cellStyle: function (value, row, index) {
                return {css: {"overflow":"hidden","white-space":"nowrap","text-overflow":"ellipsis"}}
            }
        },
        {title: '医生', field: 'doctor', align: 'center', valign: 'middle', sortable: true, width: 110},
        {
            title: '操作时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true, width: 170,
            formatter: function (value, row, index) {
                return value.substring(0, 19);
            }
        },
        {title: '详情', field: 'classname', align: 'center', valign: 'middle', sortable: true, width: 280,
            formatter: function (value, row, index) {
                return "<span title='"+value+"'>" + value + "</span>"
            },
            cellStyle: function (value, row, index) {
                return {css: {"overflow":"hidden","white-space":"nowrap","text-overflow":"ellipsis"}}
            }
        },
        {title: '备注', field: 'remarks', align: 'center', valign: 'middle', sortable: true, width: 110,
            formatter: function (value, row, index) {
                return "<span title='"+value+"'>" + value + "</span>"
            },
            cellStyle: function (value, row, index) {
                return {css: {"overflow":"hidden","white-space":"nowrap","text-overflow":"ellipsis"}}
            }
        },
        {title: '是否成功', field: 'succeed', align: 'center', valign: 'middle', sortable: true, width: 110}
    ];
};
CustomerReservationsUpdateLog.formParams = function () {
    var queryData = {};
    queryData['singlePerson'] = $("#singlePerson").val();
    queryData['customerPhone'] = $("#customerPhone").val();
    queryData['customerName'] = $("#customerName").val();
    queryData['startTime'] = $("#startTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
}
CustomerReservationsUpdateLog.resetSearch = function () {
    $("#singlePerson").val("");
    $("#customerPhone").val("");
    $("#customerName").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    CustomerReservationsUpdateLog.search();
};
CustomerReservationsUpdateLog.search = function () {
    CustomerReservationsUpdateLog.table.refresh({query: CustomerReservationsUpdateLog.formParams()});
};
CustomerReservationsUpdateLog.time = function () {
    var time = new Date();
    var month = time.getMonth() + 1;
    var day = time.getDate();
    if (month < 10) {month = "0" + month}
    if (day < 10) {day = "0" + day}
    $("#startTime").val(time.getFullYear() + "-" + month + "-" + day + " " + "00:00:00");
    $("#endTime").val(time.getFullYear() + "-" + month + "-" + day + " " + "23:59:59");
    CustomerReservationsUpdateLog.search()
};

$(function () {
    var defaultColunms = CustomerReservationsUpdateLog.initColumn();
    var table = new BSTable(CustomerReservationsUpdateLog.id, "/customerStatusLog/updateList", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(CustomerReservationsUpdateLog.formParams());
    CustomerReservationsUpdateLog.table = table.init();
    CustomerReservationsUpdateLog.table = table;
    CustomerReservationsUpdateLog.time();
    checkDate = function () {CustomerReservationsUpdateLog.search();};
    $(document).on('click', '#laydate_clear,#laydate_today,#laydate_ok', function () {CustomerReservationsUpdateLog.search();});
});
